package com.ldc.controller.user;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ldc.model.BaseBean;
import com.ldc.model.SysUserBean;
import com.ldc.model.utils.ResultUtils;
import com.ldc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户Controller
 *
 * @auther liudc
 * @since 2022/11/2
 */
@RestController
@RequestMapping(value = "/user")
public class UserController {

    @Autowired
    UserService userService;

    /**
     * 用户注册
     *
     * @return 实体
     */
    @PostMapping(value = "/register")
    public BaseBean register() {
        return ResultUtils.toSuccess("1");
    }

    /**
     * 获取用户信息
     *
     * @return 实体
     */
    @PostMapping(value = "/user_info")
    public BaseBean userInfo() {
        LambdaQueryWrapper<SysUserBean> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysUserBean::getId, 1);
        return ResultUtils.toSuccess(userService.getOne(queryWrapper));
    }


}
